package net.loodies;

import android.graphics.Rect;

public class Quad2D {
	int width = 0;
	int height = 0;
	int minx;
	int miny;
	int maxx;
	int maxy;
	int2 position;

	public Quad2D(int w, int h, int posx, int posy) {
		width = w;
		height = h;
		position = new int2(posx, posy);

	}

	public void UpdatePosition(int x, int y) {
		position.x = x;
		position.y = y;
		minx = position.x;
		maxx = position.x + width;
		miny = position.y;
		maxy = position.y + height;
	}
	public void UpdatePositionRect(Rect rect) {
		minx = rect.left;
		maxx = rect.right;
		miny = rect.top;
		maxy = rect.bottom;
	}
	public boolean IsIn(int x, int y) {
		if (x > minx && x < maxx && y > miny && y < maxy) {
			return true;
		}
		return false;
	}
}
